﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MyMovieSystem
{
    public partial class FrmGrade : Form
    {
        public FrmGrade()
        {
            InitializeComponent();
        }

        public Movie movie = new Movie();

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            label1.Visible = textBox1.Text.Length < 1;
        }

        private void label1_Click(object sender, EventArgs e)
        {
            textBox1.Focus();
        }

        #region 按钮Checked值改变时发生
        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton rdo = new RadioButton();

            if (sender.Equals(radioButton1))
            {
                label3.Text = "2";
                rdo = radioButton1;
            }
            else if (sender.Equals(radioButton2))
            {
                label3.Text = "4";
                rdo = radioButton2;
            }
            else if (sender.Equals(radioButton3))
            {
                label3.Text = "6";
                rdo = radioButton3;
            }
            else if (sender.Equals(radioButton4))
            {
                label3.Text = "8";
                rdo = radioButton4;
            }
            else if (sender.Equals(radioButton5))
            {
                label3.Text = "10";
                rdo = radioButton5;
            }
            if (rdo.Checked)
            {
                rdo.ForeColor = Color.OrangeRed;
            }
            else
            {
                rdo.ForeColor = Color.Black;
            }
        }
        #endregion

        //确定
        private void button1_Click(object sender, EventArgs e)
        {
            if (label3.Text.Length < 1)
            {
                MessageBox.Show("亲，评个分给个评价吧！");
                return;
            }
            movie.UserGrade.Add(Convert.ToDouble(label3.Text));
            this.Close();
        }
    }
}
